package com.chelun.support.clmutifragment;

import android.graphics.Bitmap;
import android.graphics.drawable.ColorDrawable;

import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.assist.ImageScaleType;

public class DisplayImageOptionsUtil {

    //获取图像的单个图片options
    public static DisplayImageOptions getPersonImageOptions() {
        DisplayImageOptions options = new DisplayImageOptions.Builder()
                .cacheOnDisk(true)
                .cacheInMemory(true)
                .showImageForEmptyUri(R.drawable.clwelfare_icon_defalut_avatar)
                .showImageOnLoading(R.drawable.clwelfare_icon_defalut_avatar)
                .showImageOnFail(R.drawable.clwelfare_icon_defalut_avatar)
                .build();
        return options;
    }

    //获取一般图片的options
    public static DisplayImageOptions getNormalImageOptions() {
        DisplayImageOptions options = new DisplayImageOptions.Builder()
                .cacheInMemory(true)
                .resetViewBeforeLoading(true)
                .showImageOnLoading(new ColorDrawable(0xffe9e9e9))
                .showImageForEmptyUri(new ColorDrawable(0xffe9e9e9))
                .showImageOnFail(new ColorDrawable(0xffe9e9e9))
                .cacheOnDisk(true)
                .build();
        return options;
    }

    public static DisplayImageOptions getHomePagePictureOptions() {
        DisplayImageOptions options = new DisplayImageOptions.Builder().cacheInMemory(false).bitmapConfig(Bitmap.Config.RGB_565).showImageOnLoading(new ColorDrawable(0xffe9e9e9))
                .showImageForEmptyUri(new ColorDrawable(0xffe9e9e9)).cacheOnDisk(true).showImageOnFail(new ColorDrawable(0xffe9e9e9)).build();
        return options;
    }

    public static DisplayImageOptions getSimpleImageOptions() {
        DisplayImageOptions simpleImageOptions = new DisplayImageOptions.Builder()
                .cacheInMemory(true)
                .cacheOnDisk(true)
                .build();

        return simpleImageOptions;
    }

    public static DisplayImageOptions getMyImageOptions(int resouceId) {
        DisplayImageOptions options = new DisplayImageOptions.Builder()
                .cacheInMemory(true)
                .showImageOnLoading(resouceId)
                .showImageForEmptyUri(resouceId)
                .showImageOnFail(resouceId)
                .cacheOnDisk(true)
                .build();
        return options;
    }

    public static DisplayImageOptions getWelfareGoodsOptions() {
        DisplayImageOptions welfareGoodsOptions = new DisplayImageOptions.Builder().cacheInMemory(true).cacheOnDisk(true)
                .showImageForEmptyUri(R.drawable.clwelfare_icon_default_goods)
                .showImageOnFail(R.drawable.clwelfare_icon_default_goods)
                .showImageOnLoading(R.drawable.clwelfare_icon_default_goods).build();

        return welfareGoodsOptions;
    }

    //获取下载图片的options
    public static DisplayImageOptions getDownImageOptions() {
        DisplayImageOptions options = new DisplayImageOptions.Builder()
                .resetViewBeforeLoading(false)  // default
                .cacheInMemory(true) // default
                .resetViewBeforeLoading(true)
                .cacheOnDisk(true) // default
                .imageScaleType(ImageScaleType.IN_SAMPLE_INT) // default
                .bitmapConfig(Bitmap.Config.RGB_565) // default
                .build();
        return options;
    }
}
